package lab02.test21;

/**
 * Created by 星月 on 2017/10/31.
 */
public class Counter {
        public int counter (String str,char ch){
            int i = 0;
            int count = 0;
            for (i = 0; i < str.length(); i++) {
                if (str.charAt(i) == ch) {
                    count++;
                }
            }
            return count;
        }
    public static void main(String[] args) {
        System.out.println(new Counter().counter("helloworld", 'l'));
    }
}
